import Vue from 'vue'
import VueRouter from "vue-router";
//第一步：导入这两个
import ArticleDetail from '@/views/ArticleDetail'
import Layout from '@/views/Layout'
//第四步：导入Article
import Article from '@/views/Article'

//第六步：引入其他的页面组件：
import Collect from '@/views/Collect'
import Like from '@/views/Like'
import User from '@/views/User'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    //第二步：配置path和component
    {
      path:'/',
      component:Layout,
      //第三步：写二级路由：
      children:[
        {
          path:'/article',
          component:Article
        },
        //第七步：写其他二级路由：
        {
          path:'/collect',
          component:Collect
        },
        {
          path:'/like',
          component:Like
        },
        {
          path:'/user',
          component:User
        },
      ]
    },
    {
      //第十六步：动态匹配路由，需要一个id作为参数
      path:'/detail/:id',
      component:ArticleDetail
    }
  ]
})

export default router